package cn.stylefeng.guns.modular.cb.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.cb.model.params.CbObjectiveParam;
import cn.stylefeng.guns.modular.cb.model.result.CbObjectiveResult;
import cn.stylefeng.guns.modular.cb.service.CbObjectiveService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.kernel.model.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 控制器
 * 求职信息
 * @author wj
 * @Date 2021-01-06 21:06:44
 */
@RestController
@RequestMapping("/api/objective")
public class CbObjectiveController extends BaseController {

    @Autowired
    private CbObjectiveService cbObjectiveService;

    /**
     * 新增接口
     *
     * @author wj
     * @Date 2021-01-06
     */
    @RequestMapping("/addItem")
    public ResponseData addItem(CbObjectiveParam cbObjectiveParam) {
        this.cbObjectiveService.add(cbObjectiveParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author wj
     * @Date 2021-01-06
     */
    @RequestMapping("/editItem")
    public ResponseData editItem(CbObjectiveParam cbObjectiveParam) {
        this.cbObjectiveService.update(cbObjectiveParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author wj
     * @Date 2021-01-06
     */
    @RequestMapping("/delete")
    public ResponseData delete(CbObjectiveParam cbObjectiveParam) {
        this.cbObjectiveService.delete(cbObjectiveParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author wj
     * @Date 2021-01-06
     */
    @RequestMapping("/detail")
    public ResponseData detail(CbObjectiveParam cbObjectiveParam) {
//        CbObjective detail = this.cbObjectiveService.getById(cbObjectiveParam.getId());
        CbObjectiveResult detail = this.cbObjectiveService.findBySpec(cbObjectiveParam);
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author wj
     * @Date 2021-01-06
     */
    @RequestMapping("/list")
    public LayuiPageInfo list(CbObjectiveParam cbObjectiveParam) {
        return this.cbObjectiveService.findPageBySpec(cbObjectiveParam);
    }

    /**
     * 查询列表
     *
     * @author wj
     * @Date 2021-01-06
     */
    @RequestMapping("/list_objective")
    public ResponseData listObjective(CbObjectiveParam cbObjectiveParam) {
        List<CbObjectiveResult> list = this.cbObjectiveService.findListBySpec(cbObjectiveParam);
        return ResponseData.success(list);
    }

}


